<?php
session_start();

if ( $_SESSION['manager'] )
{
    require_once('../core/core.php');

    if ( ($id = $_GET['id']) && is_numeric($id) )
    {
	if ( $_GET['select'] == 'on' ) { $_SESSION['select']['customer'][$id] = 1; }
	else { unset($_SESSION['select']['customer'][$id]); }
    }
    else
    if ( $id == 'all' )
    {
	if ( $_GET['select'] == 'on' )
	{
	    $customer = new Customer;

	    $customer->addFilter($_SESSION['filter']['customer_list']);

	    foreach ( $customer->getList() as $c )
	    {
		$_SESSION['select']['customer'][$c['id']] = 1;
	    }
	}
	else { unset($_SESSION['select']['customer']); }
    }

    print json_encode(array('code'=>200));
}
?>
